<style type="text/css">
    .title-left a{color:#888;}
    .title-left .active{color:#009997;}
</style>
<div class="comm-top">
	<div class="title-left">
		<a href="interact.php" <{if $smarty.get.act==''}>class="active"<{/if}> >48小时内消息</a>
        &nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="interact.php?act=history" <{if $smarty.get.act=='history'}>class="active"<{/if}> >历史消息</a>
	</div>
	<div class="title-right">
    <form method="get" action="interact.php">
        <input type="hidden" name="act" value="<{$smarty.get.act}>" />
        <input name="keyword" class="textarea search_inp" style="width:200px;" placeholder="请输入消息内容" type="text" value="<{$smarty.get.keyword}>"/>
        <input value="搜索" class="btn btn-success search_btn" type="submit" />
    </form>
	</div>
</div>
<div style="clear:both;"></div>
<div class="list-table">
	<div class="wrapper">
		<table class="stable">
			<thead>
				<tr>
					<th style="width:70px;">头像</th>
					<th style="width:70px;">昵称</th>
					<th style="width:500px;">消息内容</th>
					<th style="width:400px;">回复内容 | 时间</th>
					<th style="width:170px;">时间</th>
					<{if $smarty.get.act==''}><th style="width:150px;">操作</th><{/if}>
				</tr>
			</thead>
			<tbody>
                <form id="memberForm">
                <{foreach from=$list item=v}>
					<tr>
						<td><{if $v.headimgurl}><img src="<{$v.headimgurl}>" /><{/if}></td>
						<td><{$v.nickname}></td>
						<td style="white-space:normal;"><{$v.msg_content}></td>
						<td style="white-space:normal;"><{$v.reply_list}></td>
						<td><{$v.create_date}></td>
						<{if $smarty.get.act==''}><td><span onclick="replyMsg('<{$v.nickname}>','<{$v.id}>')" class="btngreen30">回复</span></td><{/if}>
					</tr>
                <{/foreach}>
                </form>
			</tbody>
		</table>
        <{if $page}><div class="page-list"><{$page}></div><{/if}>
	</div>
</div>

<!-- 弹框 begin-->
<style>
.ddgl_fix_5072{width:100%;height:auto;overflow:hidden;position:relativ;top:0;left:0;z-index:99;display:none;}
.ddgl_fix_5072_bg{width:100%;height:100%;z-index:999;position:absolute;left:0;top:0;}
.ddgl_fix_5072_con{width:300px;height:auto;overflow:hidden;border:5px solid #e7e7e7;
    border-radius:5px;background:#fff;position:fixed;z-index:9999;left:50%;top:40%;margin:-100px 0 0 -150px;}
.ddgl_fix_5072_tit{height:30px;line-height:30px;font-size:16px;color:#009997;text-align:center;border-bottom:1px solid #ddd;}
.ddgl_fix_5072_tit span{float:right;display:block;width:20px;height:20px;background:#ccc;border-radius:50%;
    line-height:20px;text-align:center;cursor:pointer;}
.ddgl_fix_5072_slct{width:100%;padding:10px 0;font-size:14px;color:#666;text-align:center;}
.ddgl_fix_5072_slct input,#textBox{width:88%;height:100px;padding:3px;font-size:14px;border:1px solid #CCC;border-radius:4px;}
.ddgl_fix_5072_sub {width:100%;height:30px;line-height:30px;font-size:16px;color:#fff;margin-bottom:15px;}
.ddgl_fix_5072_sub input[type=button]{width:39%;height:30px;line-height:30px;text-align:center;font-size:16px;
    color:#fff;background:#ccc;margin:0 5%;border:none;border-radius:4px;cursor:pointer;} 
.ddgl_fix_5072_sub input[type=button]:first-child{background:#009997;}
</style>
<div class="ddgl_fix_5072" id="sender">
    <div class="ddgl_fix_5072_bg"></div>
    <div class="ddgl_fix_5072_con">
        <div class="ddgl_fix_5072_tit">回复消息 - <i style="font-style:normal;"></i></div>
        <form id="typeForm" onsubmit="return false;">
        <input type="hidden" id="hiddenId" value="" />
        <div class="ddgl_fix_5072_slct">
                <textarea name="" id="textBox"></textarea>
            </div>
            <div class="ddgl_fix_5072_sub">
                <input type="button" value="确定" id="sureBtn" onclick="sendSure(this)">
                <input type="button" value="取消" onclick="javascript:$('#sender').hide();$('#textBox').val('')">
            </div>
        </form>
	</div>
</div>
<!-- 弹框 end-->

<script type="text/javascript">
$(function(){
    //15s定时刷新
    if('<{$smarty.get.act}>'==''){
        //setInterval('location.reload()',15000);
    }
})
//回复消息
function replyMsg(nickname,id){
    $('#sender').show();
    $('.ddgl_fix_5072_tit i').text(nickname);
    $('#hiddenId').val(id);
}
function sendSure(obj){
    if($('#textBox').val()==''){
        note_info('回复内容不能为空',obj,'warn');return;
    }
    
    //敏感词过滤
    var matchStr,senseRow;
    var senseStr='';
    if('<{$senseRow}>'){
        senseRow=$.parseJSON('<{$senseRow}>');
        $.each(senseRow,function(i,n){
            matchStr=$('#textBox').val().match(n);
            if(matchStr){
                senseStr+='&nbsp;'+matchStr+'&nbsp;';
            }
        });
        if(senseStr){
            note_info('回复内容包含敏感词'+senseStr+'请更换',obj,'warn');return;
        }
    }
        
    $.post('interact.php',{a:'sendMsg',id:$('#hiddenId').val(),content:$('#textBox').val()},function(res){
        if(res=='suc'){
            note_info('发送成功',obj);
        }else{
            note_info('发送失败',obj,'warn');
        }
        setTimeout('window.location.reload()',1200);
    });
}
</script>